@extends('Admin.Layout.main')
@section('privateheader')
    <!-- DataTables -->
    <link rel="stylesheet" href="{{__BASE__}}/admin/plugins/datatables/dataTables.bootstrap.css">
@endsection
@section('content')
    <!-- Main content -->
    <section class="content">
        <div class="row">
            <div class="col-xs-12">
                <div class="box">
                    <div class="box-header">
                        @if($data['flag'] == 3)
                            <h3 class="box-title" style="float: left;"> 管理员列表
                                <a class="btn bg-olive" href="/admini/adminuser/create">添加管理员</a>
                                <a class="btn bg-red" href="/admini/adminuser/rb">回收站</a>
                            </h3>
                        @elseif($data['flag'] == 4)
                            <h3 class="box-title" style="float: left;">管理员列表回收站
                                <a class="btn bg-olive" href="{{__BASE__}}/admini/adminuser">管理员列表</a>
                            </h3>
                        @endif
                    </div>
                    <!-- /.box-header -->
                    <div class="box-body">
                        <table class="table table-bordered table-striped">
                            <thead>
                            <tr>
                                <th>ID</th>
                                <th>用户名称</th>
                                <th>用户主角色</th>
                                <th>用户附属角色</th>
                                <th>创建时间</th>
                                <th>修改时间</th>
                                <th>操作</th>
                            </tr>
                            </thead>
                            <tbody>
                            @if(!empty($data['list']))
                                @foreach($data['list'] as $k => $v)
                                    <tr>
                                        <td>{{$v->id or ''}}</td>
                                        <td><?php echo !empty($v->id) && $v->id == 1 ? '<font color="red">'.$v->username.'【系统】</font>' : $v->username;?></td>
                                        <td>{{$v->name or ''}}</td>
                                        <td>{{$v->mtitle or ''}}</td>
                                        <td><?php echo !empty($v->create_time) ? date('Y-m-d H:i:s',$v->create_time) : '';?></td>
                                        <td><?php echo !empty($v->update_time) ? date('Y-m-d H:i:s',$v->update_time) : '';?></td>
                                        <td>
                                            @if($data['flag'] == 3 && $v->id != 1)
                                                <button class="btn bg-olive" type="button" onclick="javascript:location.href='/admini/adminuser/create'">添加</button>
                                                <button class="btn bg-orange" type="button" onclick="javascript:location.href='/admini/adminuser/{{$v->id or ''}}/edit'">修改</button>
                                                <button class="btn bg-red delbutton" type="button" delurl="/admini/adminuser/{{$v->id or ''}}" skipurl="/admini/adminuser" ac="1">删除</button>
                                            @elseif($data['flag'] == 4 && $v->id != 1)
                                                <button class="btn bg-orange delbutton" type="button" delurl="/admini/adminuser/{{$v->id or ''}}" skipurl="/admini/adminuser" ac="3">还原</button>
                                                <button class="btn bg-red delbutton" type="button" delurl="/admini/adminuser/{{$v->id or ''}}" skipurl="/admini/adminuser" ac="2">删除</button>
                                            @endif
                                        </td>
                                    </tr>
                                @endforeach
                            @endif
                            </tbody>
                        </table>
                        @if($data['list'])
                            {!! $data['list']->render() !!}
                        @endif
                    </div>
                    <!-- /.box-body -->
                </div>
                <!-- /.box -->
            </div>
            <!-- /.col -->
        </div>
        <!-- /.row -->
    </section>
@endsection
@section('privatefooter')
    <!-- DataTables -->
    <script src="{{__BASE__}}/admin/plugins/datatables/jquery.dataTables.min.js"></script>
    <script src="{{__BASE__}}/admin/plugins/datatables/dataTables.bootstrap.min.js"></script>
    <!-- page script -->
@endsection